/**
 * 
 */
package niuke;

import java.util.Scanner;

/**
 * @author zhongfang
 *
 */
public class 丑陋的字符串 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Scanner scanner=new Scanner(System.in);
			String string=scanner.nextLine();
			int left=-1,right=-1;
			int count=0;
			for (int j = 0; j < string.length()-1; j++) {
				if(string.charAt(j)==string.charAt(j+1)&&string.charAt(j)!='?'){
					count++;
				}
			}
			while (true) {
				while (left<string.length()-1&&string.charAt(left+1)!='?') {
					left++;
				}
				if(left==string.length())
					break;
				right=left+1;
				while (right<string.length()&&string.charAt(right)=='?') {
					right++;
				}
				if(right==string.length())
					break;
				if(left==-1){
					left=right;
					continue;
				}
				if(!((string.charAt(left)==string.charAt(right)&&(right-left)%2==0)||(string.charAt(left)!=string.charAt(right)&&(right-left)%2!=0))){
					count++;
				}
				left=right;
			}
			System.out.println(count);
		
	}

}
